//encode cusip, gen(firm)
xtset firm qrank

areg qxret logeigcenlagone, absorb(firm)

areg qxret logeigcenlagone angvollagone mktrflagone smblagone hmllagone momlagone, absorb(firm)


//panel regression for each cwec quartile
sort qrank logeigcenlagone
gen cenlagone_quartile = .
forval i = 1/94 {
    quietly count if qrank == `i' & !missing(logeigcenlagone)
    if r(N) > 0 {
        xtile temp_quartile = logeigcenlagone if qrank == `i', nq(4)
        replace cenlagone_quartile = temp_quartile if qrank == `i'
        drop temp_quartile
    }
}

sort cusip qrank

forval i = 1/4 {
    areg qxret logeigcenlagone if cenlagone_quartile == `i', absorb(firm)
}

forval i = 1/4 {
    areg qxret logeigcenlagone angvollagone mktrflagone smblagone hmllagone momlagone if cenlagone_quartile == `i', absorb(firm)
}




